home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 003 / mrim002.arc / MICRORIM.002
Encoding:
Text File  |  1986-12-02  |  52.5 KB  |  1,387 lines

  1.  
  2.  
  3.  
  4.      Volume 1, Number 2                                       November 1986
  5.      ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  6.      ::                  ***************                                 ::
  7.      ::               *********************                              ::
  8.      ::            ***************************                           ::
  9.      ::          ******************************                          ::
  10.      ::        ****************    ************                          ::
  11.      ::      ***************       *************                         ::
  12.      ::     ***************       **************                         ::
  13.      ::    ***************      ***************                          ::
  14.      ::   ****************   *****************                           ::
  15.      ::  *****************   *************                               ::
  16.      ::  *****************   **************          Microrim ONLINE     ::
  17.      :: ******************   ***************         """""""""""""""     ::
  18.      :: ******************   ****************     Online Technical News  ::
  19.      :: ******************   *****************                           ::
  20.      :: ******************   ******************                          ::
  21.      :: ******************   *******************                         ::
  22.      ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  23.      Technical tips, techniques, and announcements from Microrim, Inc.
  24.  
  25.      Microrim ONLINE is published electronically approximately every month
  26.      by Microrim, Inc. and distributed exclusively on the Microrim Bulletin
  27.      Board System (BBS).  You can obtain your copy free of charge by
  28.      downloading it from the TECH-ED area of the FILES section.  (206) 881-
  29.      8119.  Setup:  8 data bits, 1 stop bit, No parity, and 300 or 1200
  30.      baud; operating 24 hours, seven days a week.
  31.  
  32.      COPYRIGHT
  33.      """""""""
  34.      Copyright (c) 1986 by Microrim, Inc.  All rights reserved.  Microrim,
  35.      Inc. authorizes the free distribution of this document for educational
  36.      purposes as long as no charge is made and this document is distributed
  37.      exactly as is without modification.  Toward this end, this document
  38.      may be stored in, uploaded to, and downloaded from any Bulletin Board
  39.      Service (BBS) or electronic information service as long as no charge
  40.      is made.
  41.  
  42.      CONTRIBUTIONS
  43.      """""""""""""
  44.      You are encouraged to contribute to MICRORIM ONLINE.  Please upload
  45.      your article, application, or application story to the Microrim BBS or
  46.      send an IBM compatible disk in standard ASCII format to:
  47.  
  48.      Kay D. Dayss, Microrim ONLINE Editor
  49.      Microrim, Inc.
  50.      3925 159th Ave. N.E.
  51.      P.O. Box 97022
  52.      Redmond, WA  98073-9722
  53.  
  54.      By submitting an article or application to MICRORIM ONLINE, you agree
  55.      that the material is not confidential and that Microrim, Inc., may
  56.      use, duplicate, modify, publish, or sell it without obligation or
  57.      liability to you or anyone else.
  58.  
  59.  
  60.  
  61.  
  62.      MICRORIM ONLINE November 1986 ------------------------------- Page 1
  63.  
  64.  
  65.  
  66.  
  67.  
  68.      TRADEMARKS
  69.      """"""""""
  70.      R:BASE is a registered trademark of Microrim, Inc.
  71.      MICRORIM is a registered trademark of Microrim, Inc.
  72.      XRW is a trademark of Microrim, Inc.
  73.      IBM is a registered trademark of International Business Machines Corp.
  74.      XT and AT are trademarks of International Business Machines Corp.
  75.  
  76.      DISCLAIMER
  77.      """"""""""
  78.      Microrim, Inc., makes no representation or warranties with respect to
  79.      the contents hereof, and specifically disclaims any implied warranties
  80.      of merchantability or fitness for any particular purpose.  Further,
  81.      Microrim, Inc., reserves the right to revise this publication and to
  82.      make changes in the content hereof without obligation to notify any
  83.      person of such revision or change and shall not be liable for errors
  84.      contained herein or for incidental or consequential damages in
  85.      connection with the furnishing, performance, or use of this material.
  86.      All opinions and product reviews in MICRORIM ONLINE are those of the
  87.      author and not necessarily those of Microrim, Inc.
  88.  
  89.      ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  90.      ::                       TABLE OF CONTENTS                          ::
  91.      ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  92.  
  93.      Text Results and Nulls in Logical IFEQ, IFLT, and IFGT Functions......
  94.      Tracking Leads and Customers..........................................
  95.      Printing Columnar Aging Reports.......................................
  96.      Printing a Report Sorted by a Column in a Lookup Table................
  97.      Data Entry and Output Formats, Masks, or "Pictures" ..................
  98.      Printing Columnar Reports - Multiple Across Labels....................
  99.  
  100.      :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.      MICRORIM ONLINE November 1986 ------------------------------- Page 2
  129.  
  130.  
  131.  
  132.  
  133.  
  134.      ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  135.      ::                       TECHNICAL NOTES                            ::
  136.      ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  137.  
  138.  
  139.      """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
  140.      TEXT RESULTS AND NULLS IN LOGICAL IFEQ, IFLT, AND IFGT FUNCTIONS
  141.      """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
  142.      DATE      :  10/86                   NUMBER       :  EX-10-1
  143.      PRODUCT   :  R:BASE SYSTEM V         VERSIONS     :  1.0
  144.      CATEGORY  :  FUNCTIONS               SUBCATEGORY  :  TEXT/NULLS IN IF
  145.      """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
  146.  
  147.      DESCRIPTION:
  148.      """""""""""
  149.      The logical functions IFEQ, IFGT, and IFLT will not allow text
  150.      arguments, but I want to set my variable to a text value using these
  151.      functions.  For example, if a value is in a low range, I want to print
  152.      an L; if it is in a middle range, an M; and if high, an H.  The IF
  153.      functions are great for dealing with numbers, but I want the result of
  154.      the function to be the text letters L, M, or H.
  155.  
  156.  
  157.  
  158.  
  159.      EXPLANATION:
  160.      """""""""""
  161.      Use a combination of functions.  Instead of using the text character,
  162.      use its ASCII code equivalent and then use the CHAR function to
  163.      convert it to its text equivalent.
  164.  
  165.  
  166.  
  167.  
  168.      SOLUTION:
  169.      """"""""
  170.      To solve the specific example of wanting to print a letter to
  171.      represent a range of values, follow these steps:
  172.  
  173.      Step One:  Determine the ranges
  174.  
  175.      Determine the high and low values for each of the letters to be
  176.      printed and write them down.  Use only the greater than (GT), equal to
  177.      (EQ), and less than (LT) operators because operators like GE (for
  178.      greater than and equal to) are not supported by the IF functions.  For
  179.      example:
  180.  
  181.      HIGH   = GT 99                   *( FOR A RANGE OF 100 TO INFINITY )
  182.      MIDDLE = GT 49 AND LT 100        *( FOR A RANGE OF 50 TO 99 )
  183.      LOW    = LT 50                   *( FOR A RANGE UP TO 49 )
  184.  
  185.      Step Two:  Look up the ASCII codes
  186.  
  187.      Next, look up the ASCII codes for the letters you want to print.  An
  188.      ASCII chart is in your USER'S MANUAL on page 10-21.  For example, the
  189.      capital letter H is ASCII code 72, M is 77, and L is 76.
  190.  
  191.  
  192.  
  193.  
  194.      MICRORIM ONLINE November 1986 ------------------------------- Page 3
  195.  
  196.  
  197.  
  198.  
  199.  
  200.      Step Three:  Write the necessary expressions.
  201.  
  202.      Finally, write the expressions you need.  For example the following
  203.      command file will look at the last row in a table named RANGE and show
  204.      an H if the value is in the high range, an M if it is in the medium
  205.      range, or an L if it is low.  This command file assumes that the table
  206.      holding the data is named RANGE and the numeric column is named NUM.
  207.  
  208.      CLEAR ALL VAR
  209.      SET VAR VHIGH = 99    *( this is the lowest high number minus one )
  210.      SET VAR VLOW = 50     *( this is the highest low number plus one )
  211.      SET VAR VNUM TO NUM IN RANGE WHERE COUNT = LAST
  212.      SET VAR VCODE = (IFGT(.VNUM,.VHIGH,72,(IFLT(.VNUM,.VLOW,76,77))))
  213.      SET VAR VLETTER TO (CHAR(.VCODE))
  214.      SHOW VAR VLETTER
  215.  
  216.      Similar expressions can be used within the report writer to create
  217.      reports that print letters instead of numbers for ranges.  See the
  218.      technical note on Charting for a practical application of this.
  219.  
  220.      If you wanted to print a blank if the column had a NULL value and H,
  221.      M, or L if a value exists, you would slightly revise the above code to
  222.      do this.
  223.  
  224.      First you would test for the existence of a value.  If the column is
  225.      NULL, a blank is printed.  Existence is tested differently depending
  226.      on whether you have zero set on or off.  If zero is set off (which is
  227.      the default for R:BASE when no database is open), you would set a
  228.      VDECIDE variable to one (1) if the value is greater than, less than,
  229.      or equal to zero (0).  If none of these conditions is true, the value
  230.      is NULL and the VDECIDE variable is set to zero (0).  A blank is
  231.      represented by an ASCII code of 32 so that is what is used if VDECIDE
  232.      is equal to zero.  Here is the modified code to use to check for a
  233.      NULL value when zero is set off:
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.      MICRORIM ONLINE November 1986 ------------------------------- Page 4
  261.  
  262.  
  263.  
  264.  
  265.  
  266.      *( ZERO-OFF.CMD )
  267.      SET ZERO OFF
  268.      CLEAR ALL VAR
  269.      SET VAR VHIGH = 99
  270.      SET VAR VLOW = 50
  271.      SET VAR VNUM TO NUM IN RANGE WHERE COUNT = LAST
  272.      SET VAR VDECIDE TO
  273.      (IFGT(.VNUM,0,1,(IFLT(.VNUM,0,1,(IFEQ(.VNUM,0,1,0))))))
  274.      SET VAR VCODE =
  275.      (IFEQ(.VDECIDE,1,(IFGT(.VNUM,.VHIGH,72,(IFLT(.VNUM,.VLOW,76,+
  276.      77)))),32))
  277.      SET VAR VLETTER TO (CHAR(.VCODE))
  278.      SHOW VAR VLETTER
  279.  
  280.      If zero is set on, you would set a VDECIDE variable to zero (0) if the
  281.      value is equal to "" (quote quote) and otherwise set it to one (1).
  282.      When zero is set on, a NULL value is equal to "" (quote quote) in any
  283.      expression.  Use the following modified code to check for a NULL value
  284.      (in an expression) when zero is set on:
  285.  
  286.      *( ZERO-ON.CMD )
  287.      SET ZERO ON
  288.      CLEAR ALL VAR
  289.      SET VAR VHIGH = 99
  290.      SET VAR VLOW = 50
  291.      SET VAR VNUM TO NUM IN RANGE WHERE COUNT = LAST
  292.      SET VAR VDECIDE TO (IFEQ(.VNUM,"",0,1))
  293.      SET VAR VCODE =
  294.      (IFEQ(.VDECIDE,1,(IFGT(.VNUM,.VHIGH,72,(IFLT(.VNUM,.VLOW,76,+
  295.      77)))),32))
  296.      SET VAR VLETTER TO (CHAR(.VCODE))
  297.      SHOW VAR VLETTER
  298.  
  299.      Be careful to use the code appropriate for your particular zero
  300.      setting.  If you have zero set on and you use ZERO-OFF.CMD (without
  301.      the SET ZERO command in it) then you will have all your zero values
  302.      printed as blanks as well as the NULL values.  If you have zero set
  303.      off and you use ZERO-ON.CMD (without the SET ZERO command in it) then
  304.      you will get error messages similar to the following:
  305.  
  306.      -ERROR- IFEQ does not allow TEXT arguments.
  307.      -ERROR- Expression cannot be evaluated
  308.  
  309.      The methods described in this Technical Note can also be used to test
  310.      single-character text values in the logical IF functions by using this
  311.      same technique.  The logical IF functions will only accept numeric
  312.      data so all you have to do is first use the ICHAR function to change
  313.      the ASCII letter to its numeric ASCII code.  Now test the code in the
  314.      logical function.  Then, if need be, you can use the CHAR function to
  315.      set the numeric ASCII number back to the text letter it represents.
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.      MICRORIM ONLINE November 1986 ------------------------------- Page 5
  327.  
  328.  
  329.  
  330.  
  331.  
  332.      """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
  333.      TRACKING LEADS AND CUSTOMERS
  334.      """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
  335.      DATE      :  10/86                   NUMBER       :  EX-10-2
  336.      PRODUCT   :  R:BASE SYSTEM V         VERSIONS     :  1.0
  337.      CATEGORY  :  APPLICATIONS            SUBCATEGORY  :  TRACKING
  338.      """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
  339.  
  340.      DESCRIPTION:
  341.      """""""""""
  342.      I have two tables PEOPLE and ORDERS that are linked together with a
  343.      column named ID.  One has all the people in it and the other has all
  344.      the orders in it.  If there is an order for a particular person, then
  345.      that person is a customer.  Otherwise, he or she is a lead.  Obviously
  346.      this process is dynamic.  As orders come in, leads are turning into
  347.      customers.  I want to know, by looking at the PEOPLE table, who is a
  348.      lead and who is a customer.  In addition, if that person is a
  349.      customer, I  want to know when the last order date was.
  350.  
  351.  
  352.  
  353.  
  354.      EXPLANATION:
  355.      """""""""""
  356.      It is possible to automate the process of determining who is a lead
  357.      and who is a customer by setting up a simple two-column form for data
  358.      entry of orders that will automatically update a LASTORD column on the
  359.      PEOPLE table with the current order date.
  360.  
  361.      In this example, you want to know at a glance who is a lead and who is
  362.      a customer.  In addition, if the person is a customer, you want to
  363.      know the last order date.  ID is linking column.  You can do this by
  364.      using a two table data entry form and using an expression in the form
  365.      to set LASTORD in PEOPLE to the system date.  The form will be used
  366.      every time a new order is entered.
  367.  
  368.  
  369.  
  370.  
  371.      SOLUTION:
  372.      """"""""
  373.      Include the following two steps in the design of your application:
  374.  
  375.      Step One:
  376.  
  377.      Add a date column named LASTORD to the PEOPLE table.  LASTORD will
  378.      hold the last order date.  If LASTORD has no date in it, then that
  379.      person is a lead because they have never ordered any product.
  380.  
  381.  
  382.      Step Two:
  383.  
  384.      Define a data entry form named ORDERS to be used to enter all orders
  385.      into the ORDERS table.  The ORDERS form needs to have both of the two
  386.      tables associated with it, the PEOPLE table as the first table and the
  387.      ORDERS table as the second table.  Define a master lookup expression
  388.      for the PEOPLE table that will bring up the columns in the PEOPLE
  389.  
  390.  
  391.  
  392.      MICRORIM ONLINE November 1986 ------------------------------- Page 6
  393.  
  394.  
  395.  
  396.  
  397.  
  398.      table based on the ID column value entered by the operator.  The
  399.      following is an example:
  400.  
  401.      LASTNAME = LASTNAME IN PEOPLE WHERE ID = ID
  402.  
  403.      Master lookups allow you to edit data already in the PEOPLE table when
  404.      entering new orders into the ORDERS table.  For more information on
  405.      master lookups, see the LOOKING UP VALUES IN TABLES section beginning
  406.      on page 4-34 of your R:BASE System V User's Manual.
  407.  
  408.      In addition to the master lookup, add another expression for the
  409.      PEOPLE table portion of the form that looks like this:
  410.  
  411.      LASTORD = .#DATE
  412.  
  413.      Now, when a new order is entered, the ORDERS data entry form will
  414.      automatically look up the person in the PEOPLE table and assign the
  415.      system date to the LASTORD column in the PEOPLE table.
  416.  
  417.      Use the ORDERS form with the ENTER command whenever you have new
  418.      orders to be entered:
  419.  
  420.      ENTER ORDERS
  421.  
  422.      When adding new people to the PEOPLE table, use a different form that
  423.      leaves the LASTORD column null.
  424.  
  425.      Now, whenever you are looking at a particular row in the PEOPLE table,
  426.      you can tell at a glance whether or not the person is a lead or a
  427.      customer.  If LASTORD contains a date, then that person is a customer
  428.      and the date is the last day the customer placed an order.  If no date
  429.      appears, the person is a lead who has never placed an order.
  430.  
  431.  
  432.  
  433.  
  434.  
  435.      """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
  436.      PRINTING COLUMNAR AGING REPORTS
  437.      """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
  438.      DATE      :  10/86                   NUMBER       :  EX-10-3
  439.      PRODUCT   :  R:BASE SYSTEM V         VERSIONS     :  1.0
  440.      CATEGORY  :  REPORTS                 SUBCATEGORY  :  AGING/COLUMNAR REPS
  441.      """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
  442.  
  443.      DESCRIPTION:
  444.      """""""""""
  445.      I want to print a columnar aging report.  In my aging report I am
  446.      printing columns of information and I want the report to decide which
  447.      report column to use when printing a piece of data.  I want five
  448.      report columns for each of the age groupings:  current, 30 to 60 days
  449.      old, 60 to 90 days old, 90 to 120 days old, and over 120 days old.
  450.  
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457.  
  458.      MICRORIM ONLINE November 1986 ------------------------------- Page 7
  459.  
  460.  
  461.  
  462.  
  463.  
  464.      EXPLANATION:
  465.      """""""""""
  466.      Columnar reports are reports where several rows from an R:BASE table
  467.      are printed horizontally across the page into different report columns
  468.      before moving vertically to the next row in the report.  In columnar
  469.      reports, the report writer must decide which report column to use.
  470.      The decision can be based on the value of the item or on the position
  471.      of the row.
  472.  
  473.      An aging type of report is an example of a kind of columnar report
  474.      where the decision is based on the number of days that have passed
  475.      between a date stored in a date column and the current system date.
  476.      An example is a five-column aged accounts receivable report.  This
  477.      report has a line for each account and shows the age ranges for all
  478.      the dollars that are due from that account.  Each report column in the
  479.      report holds a range of ages.  With an accounts receivable report, for
  480.      example, the following inclusive age ranges are often used:  0-29 days
  481.      old (or current), 30-59 days old, 60-89 days old, 90-120 days old, and
  482.      over 120 days old.  Blanks are printed wherever there are no dollars
  483.      due in that age range.
  484.  
  485.      Three other types of columnar reports (by month, ranges, and multiple
  486.      across labels) will be covered in other Microrim Technical Notes.
  487.      Here is a synopsis of each of these three types:
  488.  
  489.  
  490.      BY MONTH TYPE OF REPORT:  Here the decision about which report column
  491.      to use is based on the month value in a date column.  In the monthly
  492.      report, there is no comparison to another date as there is in the
  493.      aging report.  A sales report by part by calendar month is a good
  494.      example of this type of report.  This report is a report with a line
  495.      for each part number and 14 columns.  The 14 columns include a column
  496.      for the part number, one for each month of the year, and the one for
  497.      total for the year.  The total quantity for each month (for each part
  498.      number) is added up and printed in the appropriate position in the
  499.      report.  If no parts for a particular part number are sold in a
  500.      particular month, then that "cell" of the report is left blank.
  501.  
  502.  
  503.      RANGES TYPE OF REPORT:  Here the report writer looks at a database
  504.      column that contains numbers and compares it to ranges that are
  505.      located in each of the report columns.  The decision about where to
  506.      print the value depends on a comparison between the value and the
  507.      applicable range(s).  Often a range report will print a letter in the
  508.      report columns to indicate what range ([H]igh, [L]ow, or [N]ormal) the
  509.      number falls under for that particular report column
  510.  
  511.      The range type of report is often used in medical, statistical, or
  512.      scientific applications.  A good example is a chemical scan report.
  513.      This report has a different normal range for each of the chemicals.
  514.      Each chemical has its own report column on the top of the page and
  515.      each line in the report represents a different sample.  Each chemical
  516.      has its own range of normal values.  The report writer prints an H in
  517.      the cell of the report if the numeric value for that sample is in the
  518.      high range for that chemical, an L if the value is low, and an N if
  519.      the value is in the normal range.  If the sample has not been tested
  520.      for a particular chemical, a blank is printed.
  521.  
  522.  
  523.  
  524.      MICRORIM ONLINE November 1986 ------------------------------- Page 8
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.      MULTI-ACROSS LABELS:  For example, three-across labels.  This kind of
  533.      report has rows of data printed across a page in columns.  Here the
  534.      decision is based on the position of the row in the table or in the
  535.      sort order.  The decision in this case has nothing to do with the
  536.      value in a column.  In a three-across situation, for example, the
  537.      first three rows are printed on the first line of the report, the next
  538.      three rows on the second line, and so forth.
  539.  
  540.  
  541.  
  542.  
  543.      SOLUTION:
  544.      """"""""
  545.      Sometimes people will look at a columnar report and attempt to design
  546.      the database to match the report.  This is not the best approach to
  547.      take.  Report column names are not the same thing as database column
  548.      names.  When designing your database, avoid including data in the
  549.      column name.  For example, the chemical scan report should NOT have a
  550.      database where every chemical is included as a separate column name.
  551.      Think of the headaches this causes over time as the chemicals change.
  552.      Just as you would not have a column for every different customer name,
  553.      do not make a column for every chemical, month, range, etc.  Although
  554.      these items are report column names on your report, they are not
  555.      appropriate as database column names.  Instead use a generic column
  556.      name such as CHEMID for chemical identification code.
  557.  
  558.      An aging report takes a set of accounts and ages the amount that is
  559.      due from or to each.  Normally, a business will print an aging report
  560.      on accounts receivable or on accounts payable.  This kind of report
  561.      adds up dollar amounts for an account that fall within a certain age
  562.      range.  The following is a typical aging report:
  563.  
  564.                      AGED ACCOUNTS RECEIVABLE REPORT
  565.  
  566.      ACCOUNT    CURRENT   30 TO 60   60 TO 90   90 TO 120   OVER 120
  567.      NUMBER               DAYS OLD   DAYS OLD   DAYS OLD    DAYS OLD
  568.      =======    =======   ========   ========   =========   ========
  569.          101                          $178.85      $73.00    $146.00
  570.          102               $324.85    $146.00     $146.00    $146.00
  571.          103    $470.85    $219.00    $219.00                $219.00
  572.          104    $908.85    $292.00                $292.00
  573.                 =======   ========   ========   =========   ========
  574.      TOTALS:  $1,379.70    $835.85    $543.85     $511.00    $511.00
  575.  
  576.      From this report, you can see at a glance which accounts have owed you
  577.      the most money for the longest time.
  578.  
  579.  
  580.  
  581.  
  582.  
  583.  
  584.  
  585.  
  586.  
  587.  
  588.  
  589.  
  590.      MICRORIM ONLINE November 1986 ------------------------------- Page 9
  591.  
  592.  
  593.  
  594.  
  595.  
  596.      To produce this report follow these steps:
  597.  
  598.      STEP ONE:  Define the database.
  599.  
  600.      This example uses a table named ACCTS with these columns:
  601.  
  602.      ACCTNUM     INTEGER     *( the account number )
  603.      AMOUNT      CURRENCY
  604.      TDATE       DATE        *( the transaction date)
  605.  
  606.      Next, you will want to load the table with data.  For this example,
  607.      the ACCTS table has the following data:
  608.  
  609.       ACCTNUM    AMOUNT          TDATE
  610.       ---------- --------------- --------
  611.              101          $73.00 05/20/86
  612.              102         $146.00 06/19/86
  613.              103         $219.00 07/15/86
  614.              104         $292.00 08/13/86
  615.              101          $73.00 07/05/86
  616.              102         $146.00 08/04/86
  617.              103         $219.00 08/30/86
  618.              104         $292.00 09/28/86
  619.              101          $73.00 07/28/86
  620.              102         $146.00 08/27/86
  621.              103         $219.00 09/22/86
  622.              104         $292.00 10/21/86
  623.              101          $73.00 08/29/86
  624.              102         $146.00 09/28/86
  625.              103         $219.00 10/24/86
  626.              104         $292.00 11/10/86
  627.              101         $105.85 08/29/86
  628.              102         $178.85 09/28/86
  629.              103         $251.85 10/24/86
  630.              104         $324.85 11/03/86
  631.  
  632.      STEP TWO:  Define and initialize the totalers you will need
  633.  
  634.      Define a variable VBLANK as CURRENCY it will be set to a null value in
  635.      the report expressions list later with the expression:
  636.  
  637.      VBLANK = ""
  638.  
  639.      Next, define and initialize all the variables that will be used as
  640.      accumulators.  An accumulator is a a variable that grows in size as
  641.      quantities are added to it.  For example:
  642.  
  643.      VTOTAL = .VTOTAL + .VADDTHIS
  644.  
  645.      Here, VTOTAL is an accumulator because an amount is being added to its
  646.      current value.  Notice how the name of the accumulator variable VTOTAL
  647.      (in the above example) appears on both the left and the right of the
  648.      equal sign.
  649.  
  650.      You will need an accumulator variable for each cell in each of the
  651.      five ages in the report.  This is because you will need to hold onto
  652.      five totals and then print.  In this aging report, break totals are
  653.  
  654.  
  655.  
  656.      MICRORIM ONLINE November 1986 ------------------------------- Page 10
  657.  
  658.  
  659.  
  660.  
  661.  
  662.      printing in each of the cells and a grand total is printing on the
  663.      TOTALS line.  Therefore you will need ten variables; one for each of
  664.      the break totals (for each of the five ages in the report) and one for
  665.      each of the grand totals (for each of the five ages).
  666.  
  667.      For the example aging report in this Technical Note, use the following
  668.      list of commands to do the necessary initializations:
  669.  
  670.      CLEAR ALL VAR
  671.      SET VAR VBLANK CURRENCY
  672.      SET VAR V1TOT TO $0.0
  673.      SET VAR V2TOT TO $0.0
  674.      SET VAR V3TOT TO $0.0
  675.      SET VAR V4TOT TO $0.0
  676.      SET VAR V5TOT TO $0.0
  677.      SET VAR V1GRAND TO $0.0
  678.      SET VAR V2GRAND TO $0.0
  679.      SET VAR V3GRAND TO $0.0
  680.      SET VAR V4GRAND TO $0.0
  681.      SET VAR V5GRAND TO $0.0
  682.  
  683.      STEP THREE:  Define the report using Reports EXPRESS
  684.  
  685.      When prompted for the name of the report, enter AGING.  Give ACCTS as
  686.      the name of the table.
  687.  
  688.      Choose Expressions from the Reports Definition Menu and set up the
  689.      expressions listed below.
  690.  
  691.      This report uses four sets of variables.  The first set of variables:
  692.      VCURRENT, V30TO60, V60TO90, V90TO120, and VOVER120 are used to hold
  693.      the value in the current row.  The second set of variables: V1TOT,
  694.      V2TOT,  V3TOT, V4TOT, and V5TOT are the accumulators for each of the
  695.      five report columns for each row.  Remember that the report columns
  696.      being accumulated are: CURRENT (0 to 29 days old), 30-60 days old, 60-
  697.      90 days old, 90-120 days old, and over 120 days old.  Each of the five
  698.      totals  are reset at break time to zero (0).
  699.  
  700.      A third set of variables: V1PRINT, V2PRINT, V3PRINT, V4PRINT, and
  701.      V5PRINT is used to print the totals before they too are reset to zero
  702.      at break time.  These print variables are necessary in order to
  703.      prevent the printing of zeros on the report.  The print variables are
  704.      set to a null value if the value of the accumulator is zero.  In
  705.      addition, you need to SET ZERO OFF and SET NULL " " before printing
  706.      the report to guarantee that the zeros on the report will print as
  707.      blanks.
  708.  
  709.  
  710.  
  711.  
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  
  718.  
  719.  
  720.  
  721.  
  722.      MICRORIM ONLINE November 1986 ------------------------------- Page 11
  723.  
  724.  
  725.  
  726.  
  727.  
  728.      The fourth and final set of variables: V1GRAND, V2GRAND, V3GRAND,
  729.      V4GRAND, and V5GRAND are used to accumulate the grand totals.  The
  730.      grand totals are not reset at break time, they continue to accumulate
  731.      the amounts for the five report columns.
  732.  
  733.        1: INTEGER :  VAGE     =  (.#DATE - 'TDATE')
  734.        2: CURRENCY:  VCURRENT =  (IFLT(.VAGE,30,'AMOUNT',0))
  735.        3: CURRENCY:  V30TO60  =  (IFEQ(.VAGE,30,'AMOUNT',(IFGT(.VAGE,30,(IF
  736.                                  LT(.VAGE,60,'AMOUNT',0)),0))))
  737.        4: CURRENCY:  V60TO90  =  (IFEQ(.VAGE,60,'AMOUNT',(IFGT(.VAGE,60,(IF
  738.                                  LT(.VAGE,90,'AMOUNT',0)),0))))
  739.        5: CURRENCY:  V90TO120 =  (IFEQ(.VAGE,90,'AMOUNT',(IFGT(.VAGE,90,(IF
  740.                                   LT(.VAGE,120,'AMOUNT',0)),0))))
  741.        6: CURRENCY:  VOVER120 =  (IFEQ(.VAGE,120,'AMOUNT',(IFGT(.VAGE,120,'
  742.                                  AMOUNT',0))))
  743.        7: CURRENCY:  VBLANK   =  ""
  744.        8: CURRENCY:  V1TOT    =  (.V1TOT + .VCURRENT)
  745.        9: CURRENCY:  V2TOT    =  (.V2TOT + .V30TO60)
  746.       10: CURRENCY:  V3TOT    =  (.V3TOT + .V60TO90)
  747.       11: CURRENCY:  V4TOT    =  (.V4TOT + .V90TO120)
  748.       12: CURRENCY:  V5TOT    =  (.V5TOT + .VOVER120)
  749.       13: CURRENCY:  V1PRINT  =  (IFEQ(.V1TOT,0,.VBLANK,.V1TOT))
  750.       14: CURRENCY:  V2PRINT  =  (IFEQ(.V2TOT,0,.VBLANK,.V2TOT))
  751.       15: CURRENCY:  V3PRINT  =  (IFEQ(.V3TOT,0,.VBLANK,.V3TOT))
  752.       16: CURRENCY:  V4PRINT  =  (IFEQ(.V4TOT,0,.VBLANK,.V4TOT))
  753.       17: CURRENCY:  V5PRINT  =  (IFEQ(.V5TOT,0,.VBLANK,.V5TOT))
  754.       18: CURRENCY:  V1GRAND  =  (.V1GRAND + .VCURRENT)
  755.       19: CURRENCY:  V2GRAND  =  (.V2GRAND + .V30TO60)
  756.       20: CURRENCY:  V3GRAND  =  (.V3GRAND + .V60TO90)
  757.       21: CURRENCY:  V4GRAND  =  (.V4GRAND + .V90TO120)
  758.       22: CURRENCY:  V5GRAND  =  (.V5GRAND + .VOVER120)
  759.  
  760.      After setting up the expressions, press the [ESC] key to return to the
  761.      Reports Definition Menu and choose Configure.  Set up ACCTNUM as the
  762.      break column, press [Y] for the variable resets, and add the following
  763.      variables to the reset list:
  764.  
  765.      V1TOT     V2TOT     V3TOT     V4TOT     V5TOT     V1PRINT   V2PRINT
  766.      V3PRINT   V4PRINT   V5PRINT
  767.  
  768.      When finished, the top of the configure menu will look like this:
  769.  
  770.  
  771.          Lines Per Page .................:   60
  772.          Remove Initial Carriage Return..:   [NO ]
  773.          Manual Break Reset .............:   [NO ]
  774.          Page Footer Line Number.........:     0
  775.  
  776.                       BREAKPOINTS                FORM FEEDS
  777.                    Break    Variable       Header         Footer
  778.                    Column   Reset       Before After   Before After
  779.                    -------- ------      ------ ------  ------ ------
  780.           Report                        [NO ]  [NO ]   [NO ]  [NO ]
  781.           Page              [NO ]
  782.           Break1   ACCTNUM  [YES]       [NO ]
  783.  
  784.      Finally, press the [ESC] key to get back to the Reports Definition
  785.  
  786.  
  787.  
  788.      MICRORIM ONLINE November 1986 ------------------------------- Page 12
  789.  
  790.  
  791.  
  792.  
  793.  
  794.      Menu and choose Edit.  Mark, edit, and locate so that the report looks
  795.      like the one listed below.  Note that the field locations on the F1
  796.      line are the following columns or variables in the following order:
  797.  
  798.      ACCTNUM   V1PRINT   V2PRINT   V3PRINT   V4PRINT   V5PRINT
  799.  
  800.      The field locations on the RF line are:
  801.  
  802.      V1GRAND  V2GRAND  V3GRAND  V4GRAND  V5GRAND
  803.  
  804.      RH                     AGED ACCOUNTS RECEIVABLE REPORT
  805.      RH
  806.      RH ACCOUNT    CURRENT   30 TO 60   60 TO 90   90 TO 120   OVER 120
  807.      RH NUMBER               DAYS OLD   DAYS OLD   DAYS OLD    DAYS OLD
  808.      RH =======    =======   ========   ========   =========   ========
  809.      F1 S     E   S      E   S      E   S      E   S       E   S      E
  810.      RF            =======   ========   ========   =========   ========
  811.      RF TOTALS:  S       E  S       E  S       E  S        E  S       E
  812.  
  813.      STEP FOUR:  Print the report
  814.  
  815.      Now you can print the report by running a command file that clears all
  816.      the variables used in the report, initializes all variables that are
  817.      used for accumulating totals, sets zero off (to keep zeros from
  818.      printing on the report), sets null to a blank, prints the report (with
  819.      any SORTED BY or WHERE clause that you need), and then sets null back
  820.      to -0-.   The following command file, for example, would work for this
  821.      sample aging report:
  822.  
  823.      CLEAR ALL VAR
  824.      SET VAR V1TOT TO $0.0
  825.      SET VAR V2TOT TO $0.0
  826.      SET VAR V3TOT TO $0.0
  827.      SET VAR V4TOT TO $0.0
  828.      SET VAR V5TOT TO $0.0
  829.      SET VAR V1GRAND TO $0.0
  830.      SET VAR V2GRAND TO $0.0
  831.      SET VAR V3GRAND TO $0.0
  832.      SET VAR V4GRAND TO $0.0
  833.      SET VAR V5GRAND TO $0.0
  834.      SET VAR VBLANK CURRENCY
  835.      SET ZERO OFF
  836.      SET NULL " "
  837.      PRINT AGING
  838.      SET NULL -0-
  839.  
  840.  
  841.  
  842.  
  843.  
  844.  
  845.  
  846.  
  847.  
  848.  
  849.  
  850.  
  851.  
  852.  
  853.  
  854.      MICRORIM ONLINE November 1986 ------------------------------- Page 13
  855.  
  856.  
  857.  
  858.  
  859.  
  860.      """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
  861.      PRINTING A REPORT SORTED BY A COLUMN IN A LOOKUP TABLE
  862.      """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
  863.      DATE      :  10/86                   NUMBER       :  EX-10-4
  864.      PRODUCT   :  R:BASE SYSTEM V         VERSIONS     :  1.0
  865.                   R:BASE 5000                             1.01 and higher
  866.      CATEGORY  :  REPORTS                 SUBCATEGORY  :  VIEWS AND SORTING
  867.      """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
  868.  
  869.      DESCRIPTION:
  870.      """""""""""
  871.      My application has all the customers and their address information in
  872.      one table and all the transactions in another table.  The two tables
  873.      are related by the customer number column CUSTID.  I want to print
  874.      labels (or a report) sorted by the zip code and I want to print only
  875.      those customers who meet certain selection criteria in the transaction
  876.      table.  The transaction table is the base table.  The address
  877.      information in the customer table is looked up.  What is the best way
  878.      to accomplish this sorting in R:BASE 5000?  In R:BASE System V?
  879.  
  880.  
  881.  
  882.  
  883.      SOLUTION:
  884.      """"""""
  885.      It is a good design strategy to separate the information into two
  886.      tables as you have done.  Therefore, keep the good design you have and
  887.      use one of the following methods:
  888.  
  889.      To sort on a column in the lookup table in R:BASE System V
  890.  
  891.      Define a VIEW using the VIEW command that contains all the columns
  892.      that you need for your report as well as the linking identification
  893.      column.  Print the report based on the VIEW.  In other words, when you
  894.      are asked for the name of the table to associate with the report, give
  895.      the name of your VIEW instead.  Then, when ready to print the report,
  896.      issue the following command:
  897.  
  898.      PRINT reptname SORTED BY ZIP
  899.  
  900.      Views are very useful for situations like this.  Views can be used in
  901.      reports and will work instead of a table name with all of the
  902.      following commands:
  903.  
  904.      PRINT          SELECT         LIST VIEWS     RENAME VIEW    RPW
  905.      COMPUTE        CROSSTAB       REMOVE VIEW    REPORTS        MPW
  906.  
  907.      To sort on a column in the look up table in R:BASE 5000
  908.  
  909.        ■  Include the zipcode as the first part of the identification
  910.        column number and then print the report sorted on the id column.
  911.        This would insure that the lookups are done in the correct order.
  912.  
  913.      OR
  914.  
  915.        ■  Intersect the two tables and print the report based on the
  916.        resulting table.
  917.  
  918.  
  919.  
  920.      MICRORIM ONLINE November 1986 ------------------------------- Page 14
  921.  
  922.  
  923.  
  924.  
  925.  
  926.  
  927.      """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
  928.      DATA ENTRY AND OUTPUT FORMATS, MASKS, OR "PICTURES"
  929.      """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
  930.      DATE      :  10/86                   NUMBER       :  EX-10-5
  931.      PRODUCT   :  R:BASE SYSTEM V         VERSIONS     :  1.0
  932.      CATEGORY  :  FORMS/REPORTS           SUBCATEGORY  :  FORMATS, MASKS &
  933.                                                           "PICTURES"
  934.      """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
  935.  
  936.      DESCRIPTION:
  937.      """""""""""
  938.      I want special formats in my forms and reports.  Some people refer to
  939.      these as masks or "pictures".  For example, when entering phone
  940.      numbers, it would be nice to have the number look like this during
  941.      data entry:
  942.  
  943.      (312) 555-1212
  944.  
  945.      However, I want to store the number in the database like this:
  946.  
  947.      3125551212
  948.  
  949.  
  950.  
  951.  
  952.      EXPLANATION:
  953.      """""""""""
  954.      R:BASE allows many different format options in both forms and reports
  955.      by using variables, functions, and concatenation schemes.
  956.  
  957.  
  958.  
  959.  
  960.      SOLUTION:
  961.      """"""""
  962.      Store the item in a text column and you can use variables, functions,
  963.      and concatenation to manipulate the display of the data in different
  964.      "picture" formats.
  965.  
  966.      For the phone number example, use the following steps for data entry
  967.      into forms according to the format you want:
  968.  
  969.        ■  Enter the text that you want in edit mode:
  970.  
  971.      (   )    -
  972.  
  973.        ■  Locate three variables: VAREA for the area code, VPRE for the
  974.        prefix, and VLAST for the last four characters.  Define all three
  975.        variables as TEXT data type.
  976.  
  977.      (S E) S E-S  E
  978.        |    |     |
  979.      VAREA VPRE VLAST
  980.  
  981.        ■  Set autoskip on before doing data entry using the form and the
  982.        cursor will automatically skip from the area code to the prefix to
  983.  
  984.  
  985.  
  986.      MICRORIM ONLINE November 1986 ------------------------------- Page 15
  987.  
  988.  
  989.  
  990.  
  991.  
  992.        the last four digits.
  993.        ■  First, make sure that your PHONE column is defined as TEXT data
  994.        type.  Then, in the expression list in forms, include the following
  995.        expression to make sure that the column PHONE is loaded with only
  996.        the numbers:
  997.  
  998.      PHONE = (.VAREA + .VPRE + .VLAST)
  999.  
  1000.      For display of the number in reports, use the SGET function to pull
  1001.      the string apart into variables and locate the variables on the
  1002.      report.  For example the following expressions in a report will
  1003.      recreate the three variables VAREA, VPRE, and VLAST:
  1004.  
  1005.      VAREA = (SGET('PHONE',3,1))
  1006.      VPRE  = (SGET('PHONE',3,4))
  1007.      VLAST = (SGET('PHONE',4,7))
  1008.  
  1009.      Now, all you need to do is edit in the parentheses and locate the
  1010.      variables just as was done in the form:
  1011.  
  1012.      (S E) S E-S  E
  1013.        |    |     |
  1014.      VAREA VPRE VLAST
  1015.  
  1016.      Using these powerful R:BASE features, you can create specialized
  1017.      formats or "pictures" of your data to meet your needs.
  1018.  
  1019.  
  1020.  
  1021.  
  1022.  
  1023.      """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
  1024.      PRINTING COLUMNAR REPORTS - MULTIPLE ACROSS LABELS
  1025.      """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
  1026.      DATE      :  10/86                   NUMBER       :  EX-10-6
  1027.      PRODUCT   :  R:BASE SYSTEM V         VERSIONS     :  1.0
  1028.      CATEGORY  :  REPORTS                 SUBCATEGORY  :  MULTI-UP LABELS
  1029.      """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
  1030.  
  1031.      DESCRIPTION:
  1032.      """""""""""
  1033.      I want to print multiple across labels.
  1034.  
  1035.  
  1036.  
  1037.  
  1038.      EXPLANATION:
  1039.      """""""""""
  1040.      Columnar reports, such as multi-across labels, are reports where
  1041.      several rows from an R:BASE table are printed horizontally across the
  1042.      page into different report columns before moving to the next row in
  1043.      the report.  In columnar reports, the report writer must decide which
  1044.      report column to use.  The decision can be based on the value of the
  1045.      item or on the position of the row.
  1046.  
  1047.      In a multiple across labels report (for example, a three-across labels
  1048.      report) the decision about which report column to use is based on the
  1049.  
  1050.  
  1051.  
  1052.      MICRORIM ONLINE November 1986 ------------------------------- Page 16
  1053.  
  1054.  
  1055.  
  1056.  
  1057.  
  1058.      position of the row in the table or the position of the row in the
  1059.      sort order.  The decision in this case has nothing to do with the
  1060.      value in a column.  In a three-across situation, for example, the
  1061.      first three rows are printed on the first line of the report, the next
  1062.      three rows on the second line, and so forth.
  1063.  
  1064.      Three other types of columnar reports (aging report, monthly report,
  1065.      and ranges report) will be covered in other Microrim Technical Notes.
  1066.      In each of these other types, it is the value in a column that
  1067.      determines which report column to use.  Here is a synopsis of each of
  1068.      these other three types:
  1069.  
  1070.  
  1071.      AGING TYPE OF REPORT:  In this type of columnar report, the decision
  1072.      is based on the number of days that have passed between a date stored
  1073.      in a date column and the current system date.  An example is a five-
  1074.      column aged accounts receivable report.  This report has a line for
  1075.      each account and shows the age ranges for all the dollars that are due
  1076.      from that account.  Each report column in the report holds a range of
  1077.      ages.  With an accounts receivable report, for example, the following
  1078.      inclusive age ranges are often used:  0-29 days old (or current), 30-
  1079.      59 days old, 60-89 days old, 90-120 days old, and over 120 days old.
  1080.      Blanks are printed wherever there are no dollars due in that age
  1081.      range.
  1082.  
  1083.  
  1084.      BY MONTH TYPE OF REPORT:  Here the decision about which report column
  1085.      to use is based on the month value in a date column.  Here there is no
  1086.      comparison to another date as there is in the aging type of report.  A
  1087.      sales report by part by calendar month is a good example of this type
  1088.      of report.  This report is a report with a line for each part number
  1089.      and 14 columns.  The 14 columns include a column for the part number,
  1090.      one for each month of the year, and the one for total for the year.
  1091.      The total quantity for each month (for each part number) is added up
  1092.      and printed in the appropriate position in the report.  If no parts
  1093.      for a particular part number are sold in a particular month, then that
  1094.      "cell" of the report is left blank.
  1095.  
  1096.  
  1097.      RANGES TYPE OF REPORT:  Here the report writer looks at a database
  1098.      column that contains numbers and compares it to ranges that are
  1099.      located in each of the report columns.  The decision about where to
  1100.      print the value depends on a comparison between the value and the
  1101.      applicable range(s).  Often a range report will print a letter in the
  1102.      report columns to indicate what range ([H]igh, [L]ow, or [N]ormal) the
  1103.      number falls under for that particular report column
  1104.  
  1105.      The range type of report is often used in medical, statistical, or
  1106.      scientific applications.  A good example is a chemical scan report.
  1107.      This report has a different normal range for each of the chemicals.
  1108.      Each chemical has its own report column on the top of the page and
  1109.      each line in the report represents a different sample.  Each chemical
  1110.      has its own range of normal values.  The report writer prints an H in
  1111.      the cell of the report if the numeric value for that sample is in the
  1112.      high range for that chemical, an L if the value is low, and an N if
  1113.      the value is in the normal range.  If the sample has not been tested
  1114.      for a particular chemical, a blank is printed.
  1115.  
  1116.  
  1117.  
  1118.      MICRORIM ONLINE November 1986 ------------------------------- Page 17
  1119.  
  1120.  
  1121.  
  1122.  
  1123.  
  1124.      SOLUTION:
  1125.      """"""""
  1126.      This is how a multi-across labels report looks:
  1127.  
  1128.      GEORGE MEAKER        ALANA SMITH           JOSEPH ANDERSON
  1129.      JIMS GARAGE          ANDERSONS             APPLE BERRY PRODUCTS
  1130.      302 PAULINE          P.O. BOX 17026        4000 CONSTITUTION
  1131.      ANN ARBOR MI 48104   SEATTLE WA 98107      REDMOND WA 98073
  1132.  
  1133.  
  1134.      JIM WESTERFIELD      MARY APPLE            MELANIE SODDERDON
  1135.      MEYERSON FABRICS     EDUCATIONAL PRODUCTS  JONES AND SMITH
  1136.      123 NORTH MAIN ST    345 STEVENS DR.       567 LOST LANE
  1137.      SEATTLE WA 98107     JONESTOWN IN 47356    LEMA TX 76999
  1138.  
  1139.  
  1140.      JOHN MINKLE          JOHN SMITH            MARY JOHNSON
  1141.      THE MEDICINE SHOP    COMPUTER CONSULTANTS  MARIA APPLEBERRY, MD
  1142.      123 SMITH            12 MIDDLE STREET      123 MAIN ST
  1143.      LONE RANGE NM 88456  NETTLES NJ 07045      NEW YORK NY 14483
  1144.  
  1145.      Use this kind of report to print repeating groups of information
  1146.      across the page.  The example presented here uses three groups and
  1147.      because labels are being printed it is called a three-across labels
  1148.      report.
  1149.  
  1150.      To produce this report follow these steps:
  1151.  
  1152.      STEP ONE:  Define the database.
  1153.  
  1154.      This example uses a table named PEOPLE with these columns:
  1155.  
  1156.         # Name     Type     Length         Key   Expression
  1157.         1 FIRST    TEXT      10 characters
  1158.         2 LAST     TEXT      14 characters
  1159.         3 COMPANY  TEXT      24 characters
  1160.         4 ADDR     TEXT      24 characters
  1161.         5 CITY     TEXT      15 characters
  1162.         6 STATE    TEXT       2 characters
  1163.         7 ZIP      TEXT      10 characters
  1164.  
  1165.  
  1166.  
  1167.  
  1168.  
  1169.  
  1170.  
  1171.  
  1172.  
  1173.  
  1174.  
  1175.  
  1176.  
  1177.  
  1178.  
  1179.  
  1180.  
  1181.  
  1182.  
  1183.  
  1184.      MICRORIM ONLINE November 1986 ------------------------------- Page 18
  1185.  
  1186.  
  1187.  
  1188.  
  1189.  
  1190.      Next, load the table with data.  For this example, the table has this
  1191.      data in it:
  1192.  
  1193.      FIRST   LAST        COMPANY              ADDR              ST ZIP
  1194.      ------- ----------- -------------------- ----------------- -- -----
  1195.      GEORGE  MEAKER      JIMS GARAGE          302 PAULINE       MI 48104
  1196.      ALANA   SMITH       ANDERSONS            P.O. BOX 17026    WA 98107
  1197.      JOSEPH  ANDERSON    APPLE BERRY PRODUCTS 4000 CONSTITUTION WA 98073
  1198.      JIM     WESTERFIELD MEYERSON FABRICS     123 NORTH MAIN ST WA 98107
  1199.      MARY    APPLE       EDUCATIONAL PRODUCTS 345 STEVENS DR.   IN 47356
  1200.      MELANIE SODDERDON   JONES AND SMITH      567 LOST LANE     TX 76999
  1201.      JOHN    MINKLE      THE MEDICINE SHOP    123 SMITH         NM 88456
  1202.      JOHN    SMITH       COMPUTER CONSULTANTS 12 MIDDLE STREET  NJ 07045
  1203.      MARY    JOHNSON     MARIA APPLEBERRY, MD 123 MAIN ST       NY 14483
  1204.  
  1205.      STEP TWO:  Initialize variables
  1206.  
  1207.      Initialize all the variables you will be using in the report.  This
  1208.      means a variable for every element in each of the three groups plus
  1209.      two other variables VBREAKER and VCOUNTER which will be used to
  1210.      accomplish the "three-across" effect.
  1211.  
  1212.      In this example the following list of commands will do the necessary
  1213.      initializations:
  1214.  
  1215.      CLEAR ALL VARIABLES
  1216.      SET VAR V1NAME TEXT   *( Notice that each variables is repeated for )
  1217.      SET VAR V2NAME TEXT   *( the number "across" you will be printing.  )
  1218.      SET VAR V3NAME TEXT   *( Name is concatenation of FIRST & LAST.     )
  1219.      SET VAR V1COMP TEXT
  1220.      SET VAR V2COMP TEXT
  1221.      SET VAR V3COMP TEXT
  1222.      SET VAR V1ADDR TEXT
  1223.      SET VAR V2ADDR TEXT
  1224.      SET VAR V3ADDR TEXT
  1225.      SET VAR V1CSZ TEXT    *( CSZ is concatenation of CITY, STATE, ZIP )
  1226.      SET VAR V2CSZ TEXT
  1227.      SET VAR V3CSZ TEXT
  1228.      SET VAR VBREAKER INTEGER
  1229.      SET VAR VCOUNTER INTEGER
  1230.  
  1231.      This same set of initializations should also be done before running
  1232.      the report.
  1233.  
  1234.      STEP THREE:  Define the report using Reports EXPRESS
  1235.  
  1236.      First, choose Expressions from the Reports Definition Menu and set up
  1237.      the expressions listed below.  Later VBREAKER will be set up as a
  1238.      break variable in the Configuration step of report definition.
  1239.  
  1240.      It is the expressions which control the process.  In this example,
  1241.      three report columns are being printed so the number three is used in
  1242.      the denominator of the VBREAKER expression.  In this way, because
  1243.      VBREAKER is an integer, all fractional portions of the division will
  1244.      are truncated and ignored.  The report therefore only sees a change in
  1245.      value for VBREAKER every third row.  Later, in the Edit step of report
  1246.      definition, all variables being printed on the report will be located
  1247.  
  1248.  
  1249.  
  1250.      MICRORIM ONLINE November 1986 ------------------------------- Page 19
  1251.  
  1252.  
  1253.  
  1254.  
  1255.  
  1256.      in a break footer section.  This causes data to be printed only at
  1257.      break time.  Therefore, three rows of data are read in before being
  1258.      printed.
  1259.  
  1260.      If your report needs four report columns, change the three in the
  1261.      denominator expression 13 to four and between expression 12 and
  1262.      expression 13 add a set of variables for the fourth column.
  1263.  
  1264.        1: TEXT    :  V1NAME   =  .V2NAME
  1265.        2: TEXT    :  V1COMP   =  .V2COMP
  1266.        3: TEXT    :  V1ADDR   =  .V2ADDR
  1267.        4: TEXT    :  V1CSZ    =  .V2CSZ
  1268.        5: TEXT    :  V2NAME   =  .V3NAME
  1269.        6: TEXT    :  V2COMP   =  .V3COMP
  1270.        7: TEXT    :  V2ADDR   =  .V3ADDR
  1271.        8: TEXT    :  V2CSZ    =  .V3CSZ
  1272.        9: TEXT    :  V3NAME   =  ('FIRST' & 'LAST')
  1273.       10: TEXT    :  V3COMP   =  'COMPANY'
  1274.       11: TEXT    :  V3ADDR   =  'ADDR'
  1275.       12: TEXT    :  V3CSZ    =  ('CITY' & 'STATE' & 'ZIP')
  1276.       13: INTEGER :  VBREAKER =  (.VCOUNTER / 3)
  1277.       14: INTEGER :  VCOUNTER =  (.VCOUNTER + 1)
  1278.  
  1279.      The order of the expressions variables in the list is crucial.  The
  1280.      expressions are processed from top to bottom.  The first of three rows
  1281.      of data is read into the V3 set of variables in expressions 9 through
  1282.      12.  The other variables remain null because there was no value in the
  1283.      variables to the right of the equal sign when the expressions were
  1284.      being processed.  The second time through (with the second row of
  1285.      data) the V2 variables in expressions 5 through 8 save the current
  1286.      values of the V3 variables (from the first row) and then the second
  1287.      row is read into the V3 variables.  Finally, when the third row is
  1288.      read in, the V1 variables in expressions 1 through 4 take on the
  1289.      values from the first row, the V2 variables get the values from the
  1290.      second row, and the third row is read into the V3 variables.  After
  1291.      the third row, VBREAKER changes value because there is no remainder in
  1292.      the division that is done in expression 13.  When VBREAKER changes
  1293.      value the report writer interprets that as a break and the set of
  1294.      three is printed.
  1295.  
  1296.      After setting up the expressions you need, press the [ESC] key to
  1297.      return to the Reports Definition Menu and choose Configure.  Set the
  1298.      lines per page to zero.  Give VBREAKER as the break variable and press
  1299.      [Y] to add VBREAKER and VCOUNTER to the reset list.  To be completely
  1300.      safe, you might want to reset ALL the variables but remember that you
  1301.      can only have a maximum of 20 variables in the reset list.  By
  1302.      resetting all the variables, you will insure that no label is double
  1303.  
  1304.  
  1305.  
  1306.  
  1307.  
  1308.  
  1309.  
  1310.  
  1311.  
  1312.  
  1313.  
  1314.  
  1315.  
  1316.      MICRORIM ONLINE November 1986 ------------------------------- Page 20
  1317.  
  1318.  
  1319.  
  1320.  
  1321.  
  1322.      printed.  When finished, the top of the configure menu will look like
  1323.      this:
  1324.  
  1325.  
  1326.          Lines Per Page .................:     0
  1327.          Remove Initial Carriage Return..:   [NO ]
  1328.          Manual Break Reset .............:   [NO ]
  1329.          Page Footer Line Number.........:     0
  1330.  
  1331.                       BREAKPOINTS                FORM FEEDS
  1332.                    Break    Variable       Header         Footer
  1333.                    Column   Reset       Before After   Before After
  1334.                    -------- ------      ------ ------  ------ ------
  1335.           Report                        [NO ]  [NO ]   [NO ]  [NO ]
  1336.           Page              [NO ]
  1337.           Break1   VBREAKER [YES]       [NO ]
  1338.           Break2   [None]   [NO ]       [NO ]
  1339.  
  1340.  
  1341.      Finally, press the [ESC] key to get back to the Reports Definition
  1342.      Menu and choose Edit.  Mark the section F1 to make it a break footer
  1343.      section.  In this label example, you will want six F1 lines.  Now,
  1344.      press the [F9] key to turn EXPAND off and locate all the V1, V2, and
  1345.      V3 variables in their appropriate report columns.  When finished the
  1346.      report will look like this:
  1347.  
  1348.      F1S    {v1name}     E  S    {v2name}      E  S    {v3name}      E
  1349.      F1S    {v1comp}     E  S    {v2comp}      E  S    {v3comp}      E
  1350.      F1S    {v1addr}     E  S    {v2addr}      E  S    {v3addr}      E
  1351.      F1S    {v1csz}      E  S    {v2csz}       E  S    {v3csz}       E
  1352.      F1
  1353.      F1
  1354.  
  1355.      STEP FOUR:  Print the report
  1356.  
  1357.      Now you can print the report by running a command file that clears all
  1358.      the variables used in the report, initializes all variables, sets null
  1359.      to a blank, prints the report (with any SORTED BY or WHERE clause that
  1360.      you need), and then sets null back to -0-.
  1361.  
  1362.      In this way you can print data in columns across the page.  This
  1363.      method, with minor modification, also works with R:BASE 5000.  The
  1364.      only modification is in the number of expressions and the method used
  1365.      to set up the report.  With R:BASE 5000, you will need more variables
  1366.      because only one operator per expression is allowed. You will also
  1367.      need to load the first and last names into variables before
  1368.      concatenating them to form the name variables.
  1369.  
  1370.  
  1371.  
  1372.  
  1373.  
  1374.  
  1375.  
  1376.  
  1377.  
  1378.  
  1379.  
  1380.  
  1381.  
  1382.      MICRORIM ONLINE November 1986 ------------------------------- Page 21
  1383.  
  1384.  
  1385.  
  1386.  
  1387.